<?php
include_once(_CORE_PATH. "entity_prototype.php");
class CommentsEntity extends entity_prototype
{ 
	protected $_name = 'comments';
	
	public function __construct()
	{
		
	}
	
	public function SetId($id)
	{
		$this->Set('id', (int)$id);		
	}
	
	public function GetAvatar()
	{
		$avatar = $this->Get('avatar');
		if (!strlen($avatar)) return MozgCfg::GetProp('global/users//noAvatar');
		return $avatar;
	}	
	
	public function GetDateCreated($format = 'd.m.Y H:i')
	{
		return date($format, $this->Get('dateCreated'));		
	}	
	
	public function SetDateCreated($date)
	{
		$mktime = strtotime($date);
		$this->Set('dateCreated', $mktime === false ? time(): $mktime);
	}	
}